<%@page import="org.jeecgframework.web.util.StaticValue" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<head>
    <script type="text/javascript" src="plug-in/jquery/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="plug-in/tools/curdtools_zh-cn.js"></script>
    <script type="text/javascript" src="plug-in/Highcharts-4.2.4/highcharts.js"></script>
    <script type="text/javascript" src="plug-in/easyui/jquery.easyui.min.1.3.2.js"></script>
    <script type="text/javascript" src="plug-in/lhgDialog/lhgdialog.min.js"></script>
    <script type="text/javascript" src="plug-in/My97DatePicker/WdatePicker.js"></script>
    <link rel="stylesheet" href="plug-in/easyui/themes/default/easyui.css" type="text/css"></link>
    <link rel="stylesheet" href="plug-in/easyui/themes/icon.css" type="text/css"></link>
    <link rel="stylesheet" href="plug-in/tools/css/common.css" type="text/css"></link>
    <script type="text/javascript" src="plug-in/tableexcel/tableExcel.js"></script>
    <style type="text/css">
        .tabs-header {
            background: white;
        }

    </style>
    <script>
    
        /*导出报告*/
        function exportReport(tab) {
            if (tab == 1) {
                method5('table_week', "返件报告.xls");
            }
        }

        function searchReport(tab) {
            if (tab == 1) {
                var returnTime1 = $("#returnTime1").val();
                var returnTime2 = $("#returnTime2").val();
                var week = $("#week").val();
                var month = $("#month").val();
                var status = $("#status").val();
                if (week != 0 && month != 0) {
                    tip("周报和月报不能同时选择");
                    return;
                }
                $.ajax({
                    url: "zyReturnReportController.do?queryReturnReportDataFilter",
                    data: {
                        "returnTime1": returnTime1,
                        "returnTime2": returnTime2,
                        "week": week,
                        "month": month,
                        "status": status
                    },
                    async: false,
                    dataType: 'json',
                    success: function (result) {
                        $("#tbody_week").html('');
                        var html = "";
                        if (result != null && result != "") {
                            for (var i = 0; i < result.length; i++) {
                                if (result[i].returnTime != null && result[i].returnTime != "") {
                                    var newTime = new Date(result[i].returnTime);
                                    var year = newTime.getFullYear()
                                    var month = newTime.getMonth() + 1;
                                    var day = newTime.getDate();
                                    var date = year + "-" + month + "-" + day;
                                } else {
                                    var date = "";
                                }
                                html += "<tr>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].code + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].STATUS + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].deliver_type + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].logistics + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].so_code + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].sr_code + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].item + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].matter_num + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].sn + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].ver_code + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].item_total + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].serviceSn + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].applyThird + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].warehouse_position + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].NAME + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].sheng + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].shi + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].logistics_sendtime + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].gettime + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].noticeReturn_time + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + date + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].backwarehouse_time + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].INWAREHOUSE_TIME.substring(0, 11) + "</td>" +
                                    "<td>" + result[i].performance + "</td>" +
                                    "<td>" + result[i].unqualified + "</td>" +
                                    "<td nowrap=\"nowrap\";>" + result[i].judge400 + "</td>" +
                                    "</tr>";
                            }
                        }
                        $("#tbody_week").html(html);
                    }
                });

            }
        }

        function removeSearchReport() {
            $("#returnTime1").val("");
            $("#returnTime2").val("");
            $("select").find("option[value='0']").attr("selected", true);
            $("#status").find("option[value='']").attr("selected", true);
        }
    </script>
</head>
<body style="padding: 0px;margin: 0px auto;">
    <div id="tabs" style="height: 400px;">
        <a id="dlink" style="display:none;"></a>
        <table style="margin-top: 10px; margin-left: 10px;">
            <tr>
                <td>
                    <label class="report_label">通知返件时间：</label>
                    <input onclick="WdatePicker()" id="returnTime1" name="returnTime1" class="Wdate" style="width: 90px;"/>~
                    <input onclick="WdatePicker()" id="returnTime2" name="returnTime2" class="Wdate" style="width: 90px;"/>
                </td>
                <td>
                    <label class="report_label">周报：</label>
                    <select id="week" name="week">
                        <option value="0">请选择</option>
                        <option value="1">第一周</option>
                        <option value="2">第二周</option>
                        <option value="3">第三周</option>
                        <option value="4">第四周</option>
                        <option value="5">第五周</option>
                        <option value="6">第六周</option>
                        <option value="7">第七周</option>
                        <option value="8">第八周</option>
                        <option value="9">第九周</option>
                        <option value="10">第十周</option>
                        <option value="11">第十一周</option>
                        <option value="12">第十二周</option>
                        <option value="13">第十三周</option>
                        <option value="14">第十四周</option>
                        <option value="15">第十五周</option>
                        <option value="16">第十六周</option>
                        <option value="17">第十七周</option>
                        <option value="18">第十八周</option>
                        <option value="19">第十九周</option>
                        <option value="20">第二十周</option>
                        <option value="21">第二一周</option>
                        <option value="22">第二十二周</option>
                        <option value="23">第二十三周</option>
                        <option value="24">第二十四周</option>
                        <option value="25">第二十五周</option>
                        <option value="26">第二十六周</option>
                        <option value="27">第二十七周</option>
                        <option value="28">第二十八周</option>
                        <option value="29">第二十九周</option>
                        <option value="30">第三十周</option>
                        <option value="31">第三十一周</option>
                        <option value="32">第三十二周</option>
                        <option value="33">第三十三周</option>
                        <option value="34">第三十四周</option>
                        <option value="35">第三十五周</option>
                        <option value="36">第三十六周</option>
                        <option value="37">第三十七周</option>
                        <option value="38">第三十八周</option>
                        <option value="39">第三十九周</option>
                        <option value="40">第四十周</option>
                        <option value="41">第四十一周</option>
                        <option value="42">第四十二周</option>
                        <option value="43">第四十三周</option>
                        <option value="44">第四十四周</option>
                        <option value="45">第四十五周</option>
                        <option value="46">第四十六周</option>
                        <option value="47">第四十七周</option>
                        <option value="48">第四十八周</option>
                        <option value="49">第四十九周</option>
                        <option value="50">第五十周</option>
                        <option value="51">第五十一周</option>
                        <option value="52">第五十二周</option>
                    </select>
                </td>
                <td>
                    <label class="report_label">月报：</label>
                    <select id="month" name="month">
                        <option value="0">请选择</option>
                        <option value="1">第一月</option>
                        <option value="2">第二月</option>
                        <option value="3">第三月</option>
                        <option value="4">第四月</option>
                        <option value="5">第五月</option>
                        <option value="6">第六月</option>
                        <option value="7">第七月</option>
                        <option value="8">第八月</option>
                        <option value="9">第九月</option>
                        <option value="10">第十月</option>
                        <option value="11">第十一月</option>
                        <option value="12">第十二月</option>
                    </select>
                </td>
                <td>
                    <label class="report_label">返件状态：</label>
                    <t:dictSelect field="" id="status" typeGroupCode="<%=StaticValue.RETURN_STATUS_Log_Type %>"/>
                </td>
            </tr>
            <tr align="right">
                <td colspan="3">
                    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                       onclick="searchReport(1)">查询</a>
                    <a href="javascript:void(0);" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                       onclick="removeSearchReport()">重置</a>
                </td>
                <td ><a href="javascript:void(0);" class="easyui-linkbutton"
                                   data-options="iconCls:'icon-putout',plain:'true'" onclick="exportReport(1)">导出报告</a>
                </td>
            </tr>
        </table>
        <div class="pad_l_10" title="返件报告">
            <table class="report_table" id="table_week" style="width:98%;font-size: 10px">
                <thead>
                    <th>返件单号</th>
                    <th>返件状态</th>
                    <th>返件类型</th>
                    <th>返件物流</th>
                    <th>SO</th>
                    <th>SR</th>
                    <th>PartNo</th>
                    <th>物料号</th>
                    <th>返件备件SN</th>
                    <th>版本号</th>
                    <th>Qty</th>
                    <th>机器序列号</th>
                    <th>备件申请第三方</th>
                    <th>入库库位</th>
                    <th>入库仓库</th>
                    <th>取件省</th>
                    <th>取件市</th>
                    <th>发货日期</th>
                    <th>签收日期</th>
                    <th>通知返件时间</th>
                    <th>要求返回时间</th>
                    <th>物流预计回库时间</th>
                    <th>返件实际回库时间</th>
                    <th>performance</th>
                    <th>延误原因</th>
                    <th>故障描述</th>
                </thead>
                <tbody id="tbody_week">

                </tbody>
            </table>
        </div>
    </div>
</body>
